<template>
	<view class="surrender">
		
	</view>
</template>

<script setup lang="ts">
	import { ref } from 'vue';
	import { onLoad } from '@dcloudio/uni-app'
	import { getPdf } from '../../services/contract';

	const url=ref('')
	onLoad(async (option) => {
		if (option) {
			console.log(option)
			const res =	await getPdf(option.contractId)
			console.log(res.data)
			url.value=res.data
			uni.downloadFile({
			  url: res.data,
			  success: function (res) {
			    var filePath = res.tempFilePath;
			    uni.openDocument({
			      filePath: filePath,
			      showMenu: true,
			      success: function (res) {
			        console.log('打开文档成功');
			      }
			    });
			  }
			});

			
		}
	});
</script>

<style scoped>

</style>